package com;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;


public class StringUtils {
	public static String subStringOnChar(String string,String ch){
		String retValue = null;
		if(ch!=null){
			retValue = string.substring(0,string.indexOf(ch));
			System.out.println("retValue:"+retValue);
		}
		return retValue;
	}
	public static String getTimeInFormat(Long modDateInMills){
		SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy");
		Calendar cal = Calendar.getInstance();
		cal.setTimeInMillis(modDateInMills);
		System.out.println(format.format(cal.getTime()));
		return format.format(cal.getTime());
	}
	public static boolean deleteFolder(File path){
		if (path.exists()) {
	        File[] files = path.listFiles();
	        for (int i = 0; i < files.length; i++) {
	            if (files[i].isDirectory()) {
	            	deleteFolder(files[i]);
	            } else {
	                files[i].delete();
	            }
	        }
	    }
		return (path.delete());
	}
}
